package com.lancoo.znbkxx.teacher.adapter

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.lancoo.znbkxx.teacher.R
import com.lancoo.znbkxx.teacher.model.data.NewTask
import com.lancoo.znbkxx.teacher.model.data.PaperBaseInfo
import kotlinx.android.synthetic.main.item_paper_1v1_comment.view.*

/**
 * @author : wealive
 * @date   : 2020/10/9 14:39
 * @desc   :
 */
class HomeWorkAdapter(data: MutableList<PaperBaseInfo>) :
    BaseMultiItemQuickAdapter<PaperBaseInfo, BaseViewHolder>(data) {
    init {
        addItemType(0, R.layout.item_paper_1v1_unpublished)
        addItemType(1, R.layout.item_paper_1v1_hastencall)
        addItemType(2, R.layout.item_paper_1v1_comment)
        addItemType(3, R.layout.item_paper_1v1_finished)
    }

    override fun convert(helper: BaseViewHolder, item: PaperBaseInfo?) {
        helper.addOnClickListener(R.id.card)
        helper.addOnClickListener(R.id.tv_comment)
        helper.addOnClickListener(R.id.tv_detail)
        helper.addOnClickListener(R.id.iv_publish)
        helper.addOnClickListener(R.id.iv_hastencall)
        with(helper.itemView) {
            tv_paper_name.text=item!!.PaperName
            tv_type_name.text = if (item.Layer == 0) "语法专项" else "语言能力专项"
            tv_time.text= item.CreateTime
        }
    }
}